package com.cxy.datawarehouse.service;

import com.cxy.datawarehouse.entity.Element;
import com.cxy.datawarehouse.entity.ElementType;
import com.cxy.datawarehouse.mapper.ElementMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class ElementService {
    @Resource
    ElementMapper elementMapper;

    public List<Element> list() {
        return elementMapper.findAll();
    }

    public List<Element> getByTypeId(Long id) {
        return elementMapper.getElementByTypeId(id);
    }

    public void create(Element element){
        elementMapper.save(element);
    }

    public void update(Element element){
        elementMapper.save(element);
    }

    public void deleteById(Long id){
        elementMapper.deleteById(id);
    }
}
